<!DOCTYPE html>
<html>

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <title>优惠券</title>
    <link rel="stylesheet" type="text/css" href="../css/api.css" />
    <style>
    html,
    body {
        height: 100%;
    }
    
    header {
        width: 100%;
        height: 50px;
        background-color: #e3007f
    }
    
    header .back {
        position: absolute;
        bottom: 0;
        left: 0;
        width: 80px;
        height: 50px;
        z-index: 2;
    }
    
    header .back img {
        margin-top: 16px;
        margin-left: 12px;
        width: 11px;
        height: 18px;
    }
    
    header .title {
        position: relative;
        width: 100%;
        height: 50px;
        text-align: center;
        color: #fff;
        font-size: 20px;
        line-height: 50px;
    }
    
    section {
        position: relative;
        box-sizing: border-box;
        display: -webkit-box;
        display: -webkit-flex;
        display: flex;
        -webkit-box-orient: horizontal;
        -webkit-flex-flow: row;
        flex-flow: row;
        padding: 16px;
        height: 60px;
        margin-bottom: 2px;
        background-color: #fff;
    }
    
    section .input {
        -webkit-box-flex: 1;
        -webkit-flex: 1;
        flex: 1;
        box-sizing: border-box;
        padding: 6px;
        height: 28px;
        background-color: #eee;
        border-radius: 14px;
    }
    
    section .input input {
        width: 100%;
        height: 16px;
        line-height: 16px;
    }
    
    section .button {
        box-sizing: border-box;
        padding: 4px 16px;
        margin-left: 8px;
        width: 80px;
        height: 28px;
        text-align: center;
        font-size: 16px;
        color: #444;
        line-height: 18px;
        border-radius: 14px;
        border: 1px solid #aaa;
    }
    </style>
</head>

<body>
    <header id="header">
        <div class="back" tapmode onclick="api.closeWin();">
            <img src="../image/back.png">
        </div>
        <div class="title">
            我的优惠卷
        </div>
    </header>
    <section id="search">
        <div class="input">
            <input id="searchText" type="search" placeholder="请输入优惠码">
        </div>
        <div class="button">兑换</div>
    </section>
</body>
<script type="text/javascript" src="../script/api.js"></script>
<script type="text/javascript">
apiready = function() {
    var header = $api.byId('header');
    $api.fixStatusBar(header);
    var search = $api.byId('search');

    var headerH = $api.offset(header).h;
    var searchH = $api.offset(search).h;

    // 打开优惠券Frame
    api.openFrame({
        name: 'coupon_frame',
        url: './coupon_frame.html',
        rect: {
            x: 0,
            y: headerH + searchH,
            w: 'auto',
            h: 'auto'
        },
        bounces: true
    });
};
</script>

</html>
